package com.syzsn.common.repository;

import com.syzsn.common.entity.SyCountry;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SyCountryRepository extends JpaRepository<SyCountry, String> {

    @Query(value = "select * from SY_COUNTRY where sk8_type is not null order by SK8_INTERGRAL desc", nativeQuery = true)
    List<SyCountry> findSK8CountryList();

    @Query(value = "select * from SY_COUNTRY where sk8_type=?1 order by SK8_INTERGRAL desc", nativeQuery = true)
    List<SyCountry> findSK8CountryListBySk8Type(String sk8Type);

    @Query(value = "select * from SY_COUNTRY where sk2013_type is not null order by SK2013_INTERGRAL desc", nativeQuery = true)
    List<SyCountry> findSK2013CountryList();
    @Query(value = "select * from SY_COUNTRY where sk2013_type=?1 order by SK2013_INTERGRAL desc", nativeQuery = true)
    List<SyCountry> findSK2013CountryListBySk2013Type(String sk2013Type);

    @Query(value = "select * from SY_COUNTRY where continent_type=?1 and continent_sub_type=?2", nativeQuery = true)
    List<SyCountry> findCountryListByType(String continentType, String continentSubType);

    @Query(value = "select * from SY_COUNTRY where continent_type=?1", nativeQuery = true)
    List<SyCountry> findCountryListByContinentType(String continentType);

    @Query(value = "select * from SY_COUNTRY where continent_sub_type=?1", nativeQuery = true)
    List<SyCountry> findCountryListByContinentSubType(String continentSubType);

    @Query(value = "select * from SY_COUNTRY where cn_name=?1", nativeQuery = true)
    SyCountry findOneByCnName(String cnName);
}
